<?php 
/**
 * **模型
 */
class AddUserModel extends Model{
    public $table = 'user';
    
    public $validate = array(
		array('username','nonull','用户名不能为空',2,3),
		array('password1','nonull','密码不能为空',2,3),
		array('password1','minlen:6','密码不能少于六位',2,3),
		array('password1','confirm:password2','两次密码不一致',2,3),
	);
    
	/**
	 *验证添加
	 */
    public function addUser(){
        if(!$this->create()) return FALSE;
		$this->data['password'] = md5($_POST['password1']);
		$this->data['is_admin'] = 1;
        return $this->add();
    }
    
 }
 
 
 
 
 
 
 
 
 
 
 
